Open
Conversation
如果behavior在头部注入会导致computed读不到mobx-bindings的数据
Member
|
感谢你的 PR,但这个 PR 会有如你所说的一些问题。 对于需要依赖 behavior 注入顺序的,可以考虑在 ComponentWithComputed 构造器里面加一个字段,用于在 computed behavior 之前插入自定义的 behavior。 比如 ComponentWithComputed({
behaviors: ["b", "c"],
behaviorsBeforeComputed: ["a"],
}) |
Author
|
我试了一下没问题了,大佬麻烦看一下这样写行不行 @TtTRz |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
如果behavior在头部注入会导致computed读不到mobx-bindings的数据。直接改成push好像也不太好,可能会覆盖其他用户自定义的behavior定义的数据?我的想法是在behaviors查找一次有没有注入mobxBehavior,但是我调试了一下发现behavior构造出来是一个字符串,所以我不知道怎么判断好,求大佬指点改进一下。
@TtTRz